﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Zoomtel.Auth.Mvc.Attributes;
using Zoomtel.Entity.BIZ;
using Zoomtel.Persist.BIZ.Models;
using Zoomtel.Service.BIZ;
using Zoomtel.Web.Controllers;

namespace Zoomtel.Web.Areas.BIZ.Controllers
{
    [Description("产品接口")]
    public class ItemController:BizModuleController
    {
        ItemService _itemService;
        public ItemController(ItemService itemService)
        {
            _itemService = itemService;
        }

        [Page]
        [HttpGet]
        [Description("产品列表")]
        public IActionResult Index()
        {
            return View();
        }
        
        [HttpPost]
        [Description("产品新增")]
        public Task<IResultModel> Add(ItemEntity model)
        {
            return _itemService.Add(model) ;
        }

        [HttpPost]
        [Description("查询")]
        public Task<IResultModel> Query(ItemQueryModel model)
        {
            return _itemService.Query(model);
        }

        [HttpPut]
        [Description("修改")]
        public Task<IResultModel> Update(ItemEntity model)
        {
            return _itemService.Update(model);
        }

        [HttpPut]
        [Description("下架")]
        public Task<IResultModel> Delete(string itemId)
        {
            return _itemService.delete(itemId);
        }
    }
}
